#!/bin/bash
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

cd cufflink

for i in cufflink_CG_Parallel cufflink_DiagPCG_Parallel cufflink_SmAPCG_Parallel
do
	cd $i

	for j in N10 N50 N100 N500 N1000 N2000
		do
		   cd $j
			rm log.decomposePar
			rm log.testCufflinkFoam
			runApplication blockMesh
			runApplication decomposePar
			runParallel testCufflinkFoam 2
#                        echo $i $j
#                        cp ../../../decomposeParDict ./system
#                        rm log.decomposePar
#                        runApplication blockMesh
#                        runApplication decomposePar
#                        rm log.testCufflinkFoam
#                        runParallel testCufflinkFoam 6
		   cd ..
	done
	
	cd ..
done

cd ..

cd OpenFOAM

for i in GAMG6 DPCG-parallel6
do
	cd $i
	for j in N10 N50 N100 N500 N1000 N2000
		do
		   cd $j
			echo $i $j
			cp ../../../decomposeParDict ./system
			rm log.decomposePar
			runApplication blockMesh
			runApplication decomposePar
			rm log.testCufflinkFoam
			runParallel testCufflinkFoam 6
			
		   cd ..
	done
	
	cd ..
done 

cd DPCG-parallel4


	for j in N10 N50 N100 N500 N1000 N2000
	do
		cd $j
			echo DPCG-parallel4 $j
			rm log.decomposePar
			runApplication blockMesh
			runApplication decomposePar
			rm log.testCufflinkFoam
			runParallel testCufflinkFoam 4
			
		cd ..
	done
	
cd ..
 
